<?php

require_once($AppUI->getSystemClass('dp'));

class CQuotation_histories extends CDpObject{

	var $qhis_id = NULL;
	var $qhis_fkid = NULL;
	var $qhis_data = NULL;
	var $qhis_version = NULL;	

    function CQuotation_histories(){
    	$this->CDpObject('quotation_histories', 'qhis_id');
    }

    // overload the delete method of the parent class for adaptation for quotations's needs
	function deleteById($id){
		$sql = 'DELETE FROM quotation_histories WHERE qhis_id = ' . $id;
		// Delete file
		if (!db_exec($sql)) {
			return db_error();
		} else {
			return NULL;
		}
	}	

	function getListByQuoteId($uid, $id){
		$q  = new DBQuery;
		$q->addTable('quotation_histories');
		$q->addWhere('qhis_fkid = ' . $id);
		$q->addQuery('*');
		$sql = $q->prepare();
		$q->clear();
		return db_loadList($sql);
	}
}
?>